let obj = {
    a: 1,
    like:{
        n:'codeing'
    }
}

function deepClone(obj) {
    let clone = obj instanceof Array ? [] : {}
    for (const key in obj) {
        if(obj.hasOwnProperty(key)) {
            if (typeof obj[key] === 'object' && obj[key] !== null) {
                clone[key] = deepClone(obj[key])
            }
        }else{
            clone[key] = obj[key]
        }
    }


    return clone
}

let newObj = deepClone(obj)
obj.like.n = '打球'
console.log(newObj);
